package com.itheima.reggie.common;

public class UserHolder {

    private static final ThreadLocal threadLocal = new ThreadLocal();
    //存值
    public static void setUserId(Long userId) {
        threadLocal.set(userId);
    }
    //取值
    public static Long getUserId() {
        Long id = (Long) threadLocal.get();
        return id;
    }
    //释放
    public static void release(){
        threadLocal.remove();
    }

}